home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4593 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  75 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: mozart.unx.sas.com!jamie
  3. From: jamie@cdevil.unx.sas.com (James Cooper)
  4. Subject: Re: SasC linker Error:
  5. Originator: jamie@cdevil.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <DnLo2H.8ur@unx.sas.com>
  8. Date: Fri, 1 Mar 1996 17:47:05 GMT
  9. X-Nntp-Posting-Host: cdevil.unx.sas.com
  10. References:  <dkauppDnEzzs.FsD@netcom.com>
  11. Organization: SAS Institute Inc.
  12.  
  13.  
  14. In article <dkauppDnEzzs.FsD@netcom.com>, dkaupp@netcom.com (Blitter) writes:
  15. > Can someone tell me what may be causing these errors? MOBtrigger is a 
  16. >BOOL and as far a I know, its just changed using TRUE and FALSE.
  17. >
  18. > If someone can point me in the right direction I would appriciate it :).
  19. >
  20. >Thanks.
  21. >
  22. ><<start paste>>
  23. >
  24. >New Shell process 8
  25. >8.Boot:> dh0:Programming/Merc22/src/
  26. >8.Stuff2:Programming/Merc22/src> smake
  27. >SAS/C_SMAKE 6.55 (17.2.95)
  28. >Copyright (c) 1988-1995 SAS Institute, Inc.
  29. >        sc link to comm with temp_smk.tmp
  30. >SAS/C Amiga Compiler 6.56
  31. >Copyright (c) 1988-1995 SAS Institute Inc.
  32. >Slink - Version 6.56
  33. >Copyright (c) 1988-1995 SAS Institute, Inc.  All Rights Reserved.
  34. >
  35. >ERROR: Multiply defined symbol '_MOBtrigger'.
  36. >       First defined in file 'comm.o'.
  37. >        Type = RELOCATABLE   Value = 1010
  38. >       Redefined in file 'special.o'.
  39. >        Type = RELOCATABLE   Value = 9
  40. >
  41. >  [lots more 'Multiply defined symbol' errors...]
  42. >
  43. ><<end>>
  44.  
  45. Looks like you've got a common header file included by all your source
  46. modules.
  47.  
  48. In this file, your probably have
  49.  
  50.         BOOL MOBTrigger;
  51.  
  52. (maybe with initialization).
  53.  
  54. Well, that's the problem.  You've just declared a variable with the same
  55. name in each of your modules, and the linker is letting you know that
  56. you have global variables with matching names.
  57.  
  58. The proper way around this is to declare that variable in the header
  59. with the 'extern' keyword, as in
  60.  
  61.         extern BOOL MODTrigger;
  62.  
  63. then in one of your modules, put the actually variable in the .c file
  64. itself.
  65.  
  66. -- 
  67. ---------------
  68. Jim Cooper
  69. (jamie@unx.sas.com)                             bix: jcooper
  70.  
  71. Any opinions expressed herein are mine (Mine, all mine!  Ha, ha, ha!),
  72. and not necessarily those of my employer.
  73.  
  74. I'm NOT Politically Correct, but that's because I'm "Sensitivity Challenged."
  75.